﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntityFrameworkModel;

namespace SpecificCustomersFinderNative
{
    class SpecificCustomersFinderNative
    {
        static void Main()
        {
            const string ShippedCountry = "Canada";
            const int ShippedYear = 1997;

            NorthwindEntities northwindEntities = new NorthwindEntities();
            string nativeQuery = "SELECT distinct c.CompanyName " +
                "FROM Customers c join Orders o on o.CustomerID = c.CustomerID " +
                "WHERE o.ShipCountry = {0} AND YEAR(o.ShippedDate) = {1}";
            object[] parameters = {ShippedCountry, ShippedYear};
            var companies = northwindEntities.ExecuteStoreQuery<string>(nativeQuery, parameters);
            foreach (var company in companies)
            {
                Console.WriteLine(company);
            }
        }
    }
}
